# 设置构建类型为 Debug，开启调试信息
set(CMAKE_BUILD_TYPE Debug)
add_compile_options(-g)

message(STATUS "CMAKE_CURRENT_SOURCE_DIR = ${CMAKE_CURRENT_SOURCE_DIR}")
# 查找所有源码
file(GLOB_RECURSE SRC_FILES
    "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp"
    "${CMAKE_CURRENT_SOURCE_DIR}/include/*.hpp"
)

add_executable(rknpu2_rga_pyh_test main.cpp ${SRC_FILES})

message(STATUS "CMAKE_SOURCE_DIR = ${CMAKE_SOURCE_DIR}")
# 添加包含目录
include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_SOURCE_DIR}/3rdparty/rk_mpi_mmz/include
    ${CMAKE_SOURCE_DIR}/3rdparty/rknpu2/include
    ${CMAKE_SOURCE_DIR}/3rdparty/liballocator/include
    ${CMAKE_SOURCE_DIR}/3rdparty/libdrm/include
    ${CMAKE_SOURCE_DIR}/3rdparty/librga/include
)

# 添加库目录
link_directories(
    ${CMAKE_SOURCE_DIR}/3rdparty/rk_mpi_mmz/lib
    ${CMAKE_SOURCE_DIR}/3rdparty/rknpu2/lib
    ${CMAKE_SOURCE_DIR}/3rdparty/liballocator/lib
    ${CMAKE_SOURCE_DIR}/3rdparty/libdrm/lib
    ${CMAKE_SOURCE_DIR}/3rdparty/librga/lib
)

# 使用CMake变量来保存库的路径，使代码更清晰
set(ALLOCATOR_LIB "${CMAKE_SOURCE_DIR}/3rdparty/liballocator/lib/liballocator.so")
set(MPIMMZ_LIB "${CMAKE_SOURCE_DIR}/3rdparty/rk_mpi_mmz/lib/libmpimmz.so")

# 链接库 - 使用正确的库名称
target_link_libraries(rknpu2_rga_pyh_test PRIVATE 
    rga
    drm
    ${ALLOCATOR_LIB}
    rknnrt     # 正确：已验证库文件名为librknnrt.so
    ${MPIMMZ_LIB}
    ${OpenCV_LIBS}
)

